﻿using FairyGUI;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

public class ShopPage : BasePage
{
    private GList lsMenu;

    private ShopGoldPage goldPage;
    private ShopRmbPage rmbPage;

    public ShopPage(GComponent vie) : base(vie)
    {
        lsMenu = view.GetChild("n1").asList;
        lsMenu.onClickItem.Add(OnMenuClick);

        goldPage = new ShopGoldPage(view.GetChild("n2").asCom);
        rmbPage = new ShopRmbPage(view.GetChild("n3").asCom);
    }

    public override void Show()
    {
        lsMenu.selectedIndex = 0;
        lsMenu.onClickItem.Call();
    }

    public override void Close()
    {
    }

    private void OnMenuClick(EventContext context)
    {
        if (lsMenu.selectedIndex == 0)
        {
            //灵币商城
            goldPage.Show();
            rmbPage.Close();
        }
        else if (lsMenu.selectedIndex == 1)
        {
            //仙缘商城
            rmbPage.Show();
            goldPage.Close();
        }
    }
}
